// 举报原因请求
import qs from 'qs'
import { request } from './request'

// 获取举报原因
export function getReason () {
  return request({
    url: '/api/list/report/reason'
  })
}

// 获取文章举报原因
export function getArticleReason () {
  return request({
    url: '/api/list/report/reason/article'
  })
}

// 获取评论举报原因
export function getCommentReason () {
  return request({
    url: '/api/list/report/reason/comment'
  })
}

// 根据id获取举报原因
export function getReasonById (report_reason_id) {
  return request({
    url: '/admin/reportReason/get/' + report_reason_id 
  })
}

// 新增举报原因
export function addReason (report_reason, report_type) {
  return request({  
    url: '/admin/reportReason/add',
    method: 'post',
    headers:{'Content-Type':'application/x-www-form-urlencoded'},
    data: qs.stringify({
      report_reason,
      report_type
    })
  })
}

// 修改举报原因
export function updateReason (report_reason_id, report_reason) {
  return request({
    url: '/admin/reportReason/update',
    method: 'post',
    headers:{'Content-Type':'application/x-www-form-urlencoded'},
    data: qs.stringify({
      report_reason_id,
      report_reason
    })
  })
}

// 删除举报原因
export function deleteReason (report_reason_id) {
  return request({
    url: '/admin/reportReason/delete/' + report_reason_id,
    method: 'post'
  })
}